package com.cwf.common.entity.page;

import com.github.pagehelper.PageInfo;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;


@Data
public class PageResult<T> {


    private Integer pageNum;

    private Integer pageSize;

    private Integer pages;

    private Long total;

    private List<T> list;


    public static<T> PageResult<T> set(PageInfo pageInfo, List<T> list){

        PageResult<T> result = new PageResult<>();

        result.pages = pageInfo.getPages();
        result.pageNum = pageInfo.getPageNum();
        result.pageSize = pageInfo.getPageSize();

        result.total = pageInfo.getTotal();
        result.list = list;

        return result;



    }
}
